package com.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.config.annotation.EnableWebSocket;
import org.springframework.web.socket.config.annotation.WebSocketConfigurer;
import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry;

import com.controller.UserWebSocketHandler;
import com.controller.WebRTCWebSocketHandler;


@Configuration
@EnableWebSocket
public class WebSocketConfig implements WebSocketConfigurer {

    @Override
    public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
          registry.addHandler(new UserWebSocketHandler(), "/portfolio").setAllowedOrigins("*")//添加一个处理器还有定义处理器的处理路径
         .addHandler(new WebRTCWebSocketHandler(), "/video").setAllowedOrigins("*")//添加一个处理器还有定义处理器的处理路径
         .addInterceptors(new MyHandShakeInterceptor());
         //.withSockJS();
    }
}